<template>
  <div>
    <el-table
      border
      stripe
      :data="tableData"
      :height="height"
    >
      <el-table-column
        label="编号"
        width="80"
        align="center"
      >
        <template v-slot="scope">
          {{ scope.$index + 1 }}
        </template>
      </el-table-column>
      <el-table-column
        v-for="(item,index) in props"
        :key="index"
        :label="item.name"
        :prop="item.namekey"
        align="center"
      />
    </el-table>
  </div>

</template>

<script>
import { mapGetters } from 'vuex'
export default {
  props: {
    results: {
      type: Object,
      default() {
        return {
          datas: [],
          map: []
        }
      }
    }
  },
  data() {
    return {
      height: 'calc(100vh - 224px)',
      tableData: [],
      props: []
    }
  },
  computed: {
    ...mapGetters(['devices'])
  },
  watch: {
    results: {
      handler(newVal, oldVal) {
        this.tableData = newVal.datas
        this.props = newVal.map
      },
      deep: true,
      immediate: true
    }
  },
  methods: {
    edit(row) {
      this.$emit('edit', row)
    },
    changeCurrentPage(val) {
      this.$emit('changeCurrentPage', val)
    },
    changePagesize(val) {
      this.$emit('changePagesize', val)
    }
  }
}
</script>

<style lang="scss" scoped>

</style>

